Object.defineProperty(exports, "__esModule", { value: !0 }),
  (exports.default = void 0);
var e = require("../@babel/runtime/helpers/classCallCheck"),
  t = require("../@babel/runtime/helpers/createClass"),
  i = require("../libs/lodash"),
  u = (function () {
    return t(
      function t(i, u) {
        e(this, t),
          (this.audio = wx.getBackgroundAudioManager()),
          this.init(i, u);
      },
      [
        {
          key: "duration",
          get: function () {
            return this.audio.duration;
          },
        },
        {
          key: "paused",
          get: function () {
            return this.audio.paused;
          },
        },
        {
          key: "currentTime",
          get: function () {
            return this.audio.currentTime;
          },
        },
        {
          key: "src",
          get: function () {
            return this.audio.src;
          },
        },
        {
          key: "init",
          value: function (e, t) {
            var i = this.audio;
            i.onTimeUpdate(t),
              i.onPlay(e),
              i.onPause(e),
              i.onEnded(e),
              i.onSeeked(e),
              i.onStop(e),
              i.onError(e);
          },
        },
        {
          key: "play",
          value: function (e, t) {
            var i = this.src,
              u = this.audio;
            if (i && i === e) return u.play();
            (u.src = e), (u.title = t || "国家博物馆");
          },
        },
        {
          key: "pause",
          value: function () {
            this.audio.pause();
          },
        },
        {
          key: "stop",
          value: function () {
            this.audio.stop();
          },
        },
        {
          key: "seek",
          value: function (e) {
            (0, i.isNumber)(e) && this.audio.seek(e);
          },
        },
      ],
    );
  })();
exports.default = u;
